<template>
  <div id="app">
    <img v-if="obj.name ==777" class="top-theme" src="../assets/banner.jpg">
    <swiper @sub-event="onSwiperClick" :url="m3" :num="num" :obj="obj"/>
<!--    <button @click="onClick">click</button>-->
  </div>
</template>

<script>

import Swiper from '@/components/swiper'
import m3 from '../assets/banner1.png'

const obj = { name: '777' }
export default {
  name: 'Home',
  components: {
    Swiper
  },
  data () {
    return {
      m3,
      num: 11,
      obj
    }
  },
  methods: {
    onSwiperClick (event) {
      console.log(event)
      // this.$router.push('/detail/' + event)
      // this.$emit('change-view', {
      //   name: 'Detail',
      //   params: {
      //     id: 3
      //   }
      // })
      this.$store.commit('changeView', {
        routerParams: {
          name: 'Detail',
          params: {
            id: 3
          }
        }
      })
    },
    onClick () {
      this.num++
    }
  }
}
</script>

<style scoped>
#app{
  width: 100%;
}
.top-theme {
  width: 100%;
}
</style>
